#![allow(unused)]

use std::error::Error;
use std::fmt::{Display, Formatter};
use serde::{Deserialize, Serialize};


#[derive(Debug, Deserialize, Serialize)]
pub struct BusinessError {
    code: u8,
    msg: String,
}

impl BusinessError {
    pub fn new(code: u8, msg: String) -> Self {
        BusinessError {
            code,
            msg,
        }
    }
}

impl Display for BusinessError {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        write!(f, "business error msg: {}", self.msg)
    }
}

impl Error for BusinessError {}